package cn.skcks.pojo;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Blog {
	private String id;
	private String title;
	private String author;
	// 属性与数据库字段名不一致
	// createTime => create_time
	// 需 开启 mapUnderscoreToCamelCase 下划线转换为驼峰格式
	private Date createTime;
	private int views;

	public Blog() {
	}

	public Blog(String id, String title, String author, Date createTime, int views) {
		this.id = id;
		this.title = title;
		this.author = author;
		this.createTime = createTime;
		this.views = views;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public int getViews() {
		return views;
	}

	public void setViews(int views) {
		this.views = views;
	}

	@Override
	public String toString() {
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
		return "Blog{" +
				"id=" + id +
				", title='" + title + '\'' +
				", author='" + author + '\'' +
				", createTime=" + simpleDateFormat.format(createTime) +
				", views=" + views +
				'}';
	}
}